package com.rongc.client.freight.business.supply.view.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.rongc.client.freight.R;
import com.rongc.client.freight.base.BaseFragment;
import com.rongc.client.freight.base.view.widget.DividerItemDecoration;
import com.rongc.client.freight.business.supply.model.CommentBean;
import com.rongc.client.freight.business.supply.view.adapter.RecyclerSupplyCommentAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;

/**
 * Created by Bruce on 2016/11/24.
 */
public class SupplyCommentListFragment extends BaseFragment {
    @Bind(R.id.recycler)
    RecyclerView mRecyclerView;
    RecyclerSupplyCommentAdapter modelAdapter;

    List<CommentBean> datas;

    public static SupplyCommentListFragment getInstance(){
        SupplyCommentListFragment fragment = new SupplyCommentListFragment();
        Bundle bdl = new Bundle();
//        bdl.putString("orderType", orderType);
        fragment.setArguments(bdl);
        return fragment;
    }


    public void setDatas(List<CommentBean> datas){
        this.datas.clear();
        this.datas.addAll(datas);
        modelAdapter.notifyDataSetChanged();
    }


    @Override
    public void initData() {
    }

    @Override
    public void initListener() {

    }


    @Override
    public void initView() {
        datas = new ArrayList<>();

        modelAdapter = new RecyclerSupplyCommentAdapter(getActivity(),datas);
        datas.add(new CommentBean("2017-07-02 00:00:00","张学友","到位",""));
        datas.add(new CommentBean("2017-07-02 00:00:00","张学友","到位",""));
        datas.add(new CommentBean("2017-07-02 00:00:00","张学友","到位",""));
        datas.add(new CommentBean("2017-07-02 00:00:00","张学友","到位",""));
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
        mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
        mRecyclerView.setAdapter(modelAdapter);
    }


    @Override
    public int getLayoutId() {
        return R.layout.universal_recycler_2;
    }
}
